import Vue from "vue";
import Router from "vue-router";
import Home from "./views/Home/index.vue";
import Login from "./views/login/index.vue";
// import Main from "./views/Home/main.vue";

Vue.use(Router);

export default new Router({
  routes: [
    {
      path: "/",
      redirect: "/login"
    },
    // 一级路由
    {
      path: "/home",
      component: Home,
      // 二级路由
      children: [
        // {
        //   path: "", // 什么都不写 就是默认二级路由组件
        //   component: Main
        // },
        {
          // 爆款包子
          path: "/home/company",
          component: () => import("./views/company/index.vue")
        },
        {
          // 包子列表
          path: "/home/baozilist",
          component: () => import("./views/baozilist/index.vue")
        },
        {
          path: "/home/material",
          component: () => import("./views/material/index.vue")
        },
        {
          // 新闻内容管理页面
          path: "/home/detail_control",
          component: () => import("./views/detail_control/index.vue")
        },
        {
          // 新闻发布页面
          path: "/home/publish/:articleId",
          component: () => import("./views/publish/index.vue")
        },
        {
          // 由于/home/publish不能匹配带参数的 所以再写一个
          path: "/home/publish",
          component: () => import("./views/publish/index.vue")
        },
        {
          path: "/home/account",
          component: () => import("./views/account/index.vue")
        },
        {
          // 用户提交的申请信息
          path: "/home/applicationinfo",
          component: () => import("./views/applicationinfo/index.vue")
        },
        {
          // 修改banner轮播
          path: "/home/uploadBanner",
          component: () => import("./views/uploadBanner/index.vue")
        },
        {
          // 修改banner轮播
          path: "/home/uploadStore",
          component: () => import("./views/uploadStore/index.vue")
        }
      ]
    },
    {
      path: "/login",
      component: Login
    }
  ]
});
